package com.iap.common.mediator
{
	import com.iap.app.util.GlideTransitionEffect;
	
	import mx.core.UIComponent;
	
	import org.robotlegs.mvcs.Mediator;
	
	import spark.components.Group;
	
	public class BaseMediator extends Mediator
	{
		public static const FX_GLIDE_IN:uint = 0;
		public static const FX_GLIDE_OUT:uint = 1;
		
		protected function getPreviousView(container:Group):UIComponent
		{
			return container.getElementAt(0) as UIComponent;
		}
		
		protected function setView(container:Group, newView:UIComponent, transition:uint = FX_GLIDE_IN):void
		{
			container.addElement(newView);
			GlideTransitionEffect.start(newView, getPreviousView(container), transition);
		}
	}
}